﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_StaffPages_markDesign : System.Web.UI.Page
{
    int dId = 0;
    int sId = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        StaffBUS staff=new StaffBUS();
        dId = Convert.ToInt32(Request.QueryString["dId"].ToString());
        Design d1=new Design();
        d1.Id=dId;
        Design d = staff.searchDesign(d1);
        sId = d.St.Id;
        //DataSet ds = staff.searchDesignToDs(d1);
        imgDesign.ImageUrl="~/Images/Design/"+d.DesignImage;
        lblName.Text = d.Name;
        lblPostDate.Text = d.PostDate;
        lblDescription.Text = d.Description;
        lblQuotation.Text = d.Quotation;
        lblStudent.Text = d.St.Username;
    }
    protected void btnMark_Click(object sender, EventArgs e)
    {
        double mark = 0;
        if (rdb1.Checked)
        {
            mark = 1;
        }
        if (rdb2.Checked)
        {
            mark = 2;
        }
        if (rdb3.Checked)
        {
            mark = 3;
        }
        if (rdb4.Checked)
        {
            mark = 4;
        }
        if (rdb5.Checked)
        {
            mark = 5;
        }
        Design d = new Design();
        d.Id = dId;
        Staff s = new Staff();
        s.Id = Convert.ToInt32(Session["Id"].ToString());
        Mark m = new Mark();
        m.Design = d;
        m.Staff = s;
        m.Mark1 = mark;
        StaffBUS staff = new StaffBUS();
        if (staff.insertMark(m))
        {
            Response.Redirect("~/Pages/HomePage/Success.aspx");
        }
        else
        {
            lblWarning.Text = "Failed";
        }
    }
}